1. /* getint.cpp by K.Tsuru */
  2. /****************
  3. integer type
  4. skip ' ' ',' '.' since version 2.30
  5. *****************/
  6. #include "getnum.h"
  7. #include <string>
  8. using namespace std;
  9. static const char* skipch = ",. ";
  10. static bool skip(char c) {
  11. return strchr(skipch, c) != NULL;
  12. }
  13. int GetInt(){
  14. string buff;
  15. char c;
  16. while(1) {
  17. if((c = getchar())== '\n') break;
  18. if(skip(c)) continue;
  19. buff.append(1, c);
  20. }
  21. return atoi(buff.c_str()); // There is stoi() in c++11?
  22. }

getint.cpp : last modifiled at 2017/02/26 15:44:54(492 bytes)
created at 2016/04/11 11:17:20
The creation time of this html file is 2017/10/07 10:54:15 (Sat Oct 07 10:54:15 2017).